<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="(item, index) of list" :key="index">
        {{ item.area }}
      </li>
    </ul>
  </div>
</body>
<script src="lib/vue.js"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      list: []
    },
    mounted () {
      // fetch 默认是get请求
      fetch('https://api.i-lynn.cn/college')
        .then(res => res.json()) // 将结果转换成为json格式
        .then(res => {
          console.log(res)
          this.list = res.data.list
        })
      // 如果是post请求  http://121.89.205.189/apidoc/#api-User-PostUserLogin
      fetch('http://121.89.205.189/api/user/login', {
        method: 'POST',
        // body: JSON.stringify({ loginname: '18813007814', password: '123456' }),
        // body: JSON.stringify({ loginname: '19813007814', password: '123456' }),
        body: JSON.stringify({ loginname: '18813007814', password: '1234567' }),
        headers: {
          'content-type': 'application/json'
        }
      }).then(res => res.json()) // 将结果转换成为json格式
        .then(res => {
          console.log(res)
        })
    }
  })
</script>
</html>